package com.project.bean;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;

/**
 * 项目实体类
 */
public class ProjectBean {
    /*项目id*/
    private Integer prjId;
    /*项目名称*/
    private String prjName;
    /*客户名称*/
    private String customer;
    /*项目资金*/
    private Integer money;
    /*启动日期*/
    private LocalDate startDate = LocalDate.now();
    /*交互日期*/
    private LocalDate endDate;
    /*状态*/
    private String status = "开发中";
    /*剩余天数*/
    private String restDays;
    /*员工数量*/
    private Integer emNum;
    /*参与员工进度集合*/
    private List<ProgressBean> prgList;

    public ProjectBean() {
    }

    public ProjectBean(String prjName, String customer, Integer money, LocalDate endDate) {
        this.prjName = prjName;
        this.customer = customer;
        this.money = money;
        this.endDate = endDate;
    }

    public Integer getPrjId() {
        return prjId;
    }

    public void setPrjId(Integer prjId) {
        this.prjId = prjId;
    }

    public String getPrjName() {
        return prjName;
    }

    public void setPrjName(String prjName) {
        this.prjName = prjName;
    }

    public String getCustomer() {
        return customer;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public void setEmNum(Integer emNum) {
        this.emNum = emNum;
    }


    public void setCustomer(String customer) {
        this.customer = customer;
    }

    public Integer getMoney() {
        return money;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public String getRestDays() {
        if (this.status.equals("交付使用")) {
            return "已交付";
        }
        Long x = ChronoUnit.DAYS.between(LocalDate.now(),this. endDate);
        this.restDays = x + "";
        return restDays;
    }


    public Integer getEmNum() {
        return emNum;
    }


    public void setMoney(Integer money) {
        this.money = money;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public void setEndDate(LocalDate endDate) {
        this.endDate = endDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public List<ProgressBean> getPrgList() {
        return prgList;
    }

    public void setPrgList(List<ProgressBean> prgList) {
        this.prgList = prgList;
    }

    @Override
    public String toString() {
        return "ProjectBean{" +
                "prjId=" + prjId +
                ", prjName='" + prjName + '\'' +
                ", customer='" + customer + '\'' +
                ", money=" + money +
                ", startDate=" + startDate +
                ", endDate=" + endDate +
                ", status='" + status + '\'' +
                ", restDays='" + this.getRestDays() + '\'' +
                ", emNum=" + emNum +
                ", prgList=" + prgList +
                "}\n";
    }
}
